package com.candy.control;

import com.candy.bean.UserInfo;
import com.candy.model.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class LoginController {
    @Autowired
    LoginService loginService;

    /**
     * 登录方法，返回结果为true，正常跳转页面，返回结果为false，跳转到之前登录页面
     * @param userInfo
     * @return
     */
    @RequestMapping("/logined")
    public String logined(UserInfo userInfo){
      boolean  ok=  loginService.logined(userInfo);
        System.out.println(ok);
      if(ok){
          return "welcome";
      }else {
          return "../../index";
      }


    }





}
